#include "shared_ptr.hpp"
#include "weak_ptr.hpp"

namespace vl
{

void shared::release()
{
	--_ref_count;
	if(_ref_count == 0)
	{
		for(weak_ptr_common* p = _first; p; )
		{
			weak_ptr_common* n = p->next;
			p->v = 0;
			p->next = 0;
			p = n;
		}
		
		delete this;
	}
}

}
